﻿@model StudentEditViewModel
@{ 
    ViewBag.Title = "修改学生信息";
    var photoPath = "~/images/" + (Model.ExistPhotoPath ?? "img1.jpg");
    }

<form enctype="multipart/form-data" asp-controller="home" asp-action="edit" method="post" class="mt-3">
    <div asp-validation-summary="All" class="text-danger"></div>
    <input hidden asp-for="Id" />
    <input hidden asp-for="ExistPhotoPath" />
    <div class="form-group row mt-3">
        <label asp-for="Name" class="col-sm-2 col-form-label"></label>
        <div class="col-sm-10">
            <input asp-for="Name" class="form-control" placeholder="请输入名字" />
            <span asp-validation-for="Name" class="text-danger"></span>
        </div>
    </div>

    <div class="form-group row mt-3">
        <label asp-for="Email" class="col-sm-2 col-form-label"></label>
        <div class="col-sm-10">
            <input asp-for="Email" class="form-control" placeholder="请输入邮箱地址">
            <span asp-validation-for="Email" class="text-danger"></span>
        </div>
    </div>

    <div class="form-group row mt-3">
        <label asp-for="ClassName" class="col-sm-2 col-form-label"></label>
        <div class="col-sm-10">
            <select asp-for="ClassName" class="custom-select mr-sm-2"
                    asp-items="Html.GetEnumSelectList<ClassNameEnum>()">
                <option value=""> 请选择</option>
            </select>
            <span asp-validation-for="ClassName" class="text-danger"></span>
        </div>
    </div>

    <div class="form-group row mt-3">
        <label asp-for="Photo" class="col-sm-2 col-form-label"></label>
        <div class="col-sm-10">
            <div class="custom-file">
                <input asp-for="Photo" class="custom-control custom-file-input" />
            </div>
        </div>
    </div>
    <div class="form-group row mt-3 col-sm-4">
        <div class="col-sm-10">
            <img width="600" height="300" asp-append-version="true" src="@photoPath"/>
        </div>
    </div>

    <div class="form-group row mt-3">
        <div class="col-sm-10">
            <button type="submit" class="btn btn-primary">修改</button>
            <a asp-action="index" asp-controller="home" class="btn btn-primary">取消</a>
        </div>
    </div>



</form>